package cc.vv.lkbasecomponent.base.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.ArrayList;

import cc.vv.lkbasecomponent.base.ui.LKBaseFragment;


/**
 * fragment适配器
 *
 * @author: NPF
 * @date: 2017/12/20.
 */
public class LKBaseFragmentAdapter extends FragmentPagerAdapter {
    private ArrayList<LKBaseFragment> mFragments;

    public LKBaseFragmentAdapter(FragmentManager fm, ArrayList<LKBaseFragment> fragments) {
        super(fm);
        this.mFragments = fragments;
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public void finishUpdate(ViewGroup container) {
        container.invalidate();
        super.finishUpdate(container);
    }
}
